<template>
  <view class="travel-card" @click="handleClick">
    <!-- icon区 -->
    <view class="card-icon">
      <uni-icons fontFamily="iconfont" :size="50">{{ unicode }}</uni-icons>
    </view>
    <!-- 内容区 -->
    <view class="card-content">
      <view class="card-title">{{ title }}</view>
      <view class="card-desc">{{ desc }}</view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { defineProps, defineEmits } from 'vue';

const props = defineProps({
  unicode: { type: String, default: '\ue608' },
  title: { type: String, required: true },
  desc: { type: String, default: '' },
});

const emit = defineEmits(['click']);
const handleClick = () => emit('click');
</script>

<style scoped lang="scss">
.travel-card {
  display: flex;
  align-items: center;
  padding: 20rpx;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16rpx;
  box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.1);
  margin-bottom: 24rpx;
  border: 2px solid white;
  width: 100%;
  box-sizing: border-box; 
  
  /*动画*/
  opacity: 0;
  transform: translateY(20rpx);
  transition: opacity 0.5s ease, transform 0.5s ease;
  /* 卡片激活动画 */
  &.animate-fade {
    opacity: 1;
    transform: translateY(0);
  }
  /* 点击反馈 */
  &:active {
    transform: scale(0.98);
    opacity: 0.8;
  }
}

.card-icon {
  width: 60rpx;
  height: 60rpx;
  border-radius: 8rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 20rpx;
}

.card-title {
  font-size: 32rpx;
  font-weight: bold;
  margin-bottom: 8rpx;
}

.card-desc {
  font-size: 24rpx;
  color: #666;
}
</style>